<!--开票明细-->
<template>
  <div>
    <f-search-form ref='search' :more='true' @searchHandler='searchHandler'>
      <f-search-form-item label='单号' name='paymentNo' style='width: 200px' />
    </f-search-form>
    <f-table ref='table'
             rowKey='invoiceDetailsId'
             :showSetting='false'
             setting-key='invoiceDetailsId_kp_details'
             :tableColumns='columns'
             :scroll='{x:true}'
             :showMultipleBtn='false'
             :showPagination='false'
             :showTotal='true'
             :multiple='false'
             handler='hyFapiaoDetailsPageListHandler'
             :operator='operator'
             :autoLoad='false'
             :params='queryParam'
             :api='api.payment.list'>
       <span slot='settleType' slot-scope='text, record, index'>
         <a-tag color='#87d068' v-if='text==1'>渠道商</a-tag>
         <a-tag color='#f47920' v-if='text==2'>商务经理</a-tag>
         <a-tag color='#8a5d19' v-if='text==3'>片区服务商</a-tag>
         <a-tag color='#7bbfea' v-if='text==4'>商务总负责人</a-tag>
      </span>
      <span slot='invoiceType' slot-scope='text, record, index'>
            <a-tag color='#87d068' v-if='text==1'>普票</a-tag>
            <a-tag color='#108ee9' v-if='text==2'>专票</a-tag>
       </span>
      <span slot='drugType' slot-scope='text, record, index'>
           <a-tag color='#2db7f5' v-if='text=="ZY"'>自营</a-tag>
           <a-tag color='#FF0000' v-if='text=="ZS"'>招商</a-tag>
       </span>
    </f-table>
  </div>
</template>
<script>
import api from "../../../../js/api"

export default {
  name: "FapiaoDetails",
  components: {},
  props: {
    invoiceData: {
      type: Object,
      default: null
    }
  },
  data() {
    let me = this
    //操作按钮
    let operator = []
    return {
      api: Object.assign(api, this.api),
      multiple: false,
      deptId: "",
      //列表初始化查询参数
      queryParam: {
        auth: 1,
        isFlp: 1
      },
      returnCustomBond: 0,
      selectIds: "",
      params1: {
        deptId: ""
      },
      dataSource: [],
      columns: [
        {
          title: "序号",
          width: "60px",
          fixed: "left",
          align: "center",
          customRender: (text, record, index) => index + 1
        },
        {
          title: "单号",
          align: "center",
          fixed: "left",
          dataIndex: "paymentNo",
          scopedSlots: { customRender: "paymentNo" }
        },
        {
          title: "结算范围",
          align: "center",
          width: "60px",
          dataIndex: "settleType",
          scopedSlots: { customRender: "settleType" }
        },
        {
          title: "部门",
          align: "left",
          sorter: true,
          width: "80px",
          dataIndex: "deptName"
        },
        {
          title: "业务员",
          align: "left",
          sorter: true,
          width: "80px",
          dataIndex: "saleManName"
        },
        {
          title: "业务编码",
          align: "left",
          sorter: true,
          width: "80px",
          dataIndex: "saleManBusinessNo"
        },
        {
          title: "申请金额",
          align: "center",
          dataIndex: "amount",
          width: "100px",
          needTotal: true
        },
        {
          title: "申请日期",
          align: "center",
          width: "100px",
          dataIndex: "amountDate"
        },
        {
          title: "收票单位",
          align: "left",
          width: "180px",
          ellipsis: true,
          dataIndex: "companyName"
        },
        {
          title: "开票单位",
          align: "left",
          ellipsis: true,
          width: "180px",
          dataIndex: "payeeName"
        },
        {
          title: "发票项目",
          align: "left",
          ellipsis: true,
          width: "100px",
          dataIndex: "title"
        },
        {
          title: "发票类型",
          align: "center",
          width: "80px",
          dataIndex: "invoiceType",
          scopedSlots: { customRender: "invoiceType" }
        },
        {
          title: "开票金额",
          align: "left",
          needTotal: true,
          width: "80px",
          type: 10,
          dataIndex: "invoiceAmount"
        },
        {
          title: "不含税金额",
          align: "left",
          width: "90px",
          type: 10,
          needTotal: true,
          dataIndex: "noTaxAmount"
        },
        {
          title: "税费",
          align: "left",
          width: "80px",
          needTotal: true,
          type: 10,
          dataIndex: "taxAmount"
        },
        {
          title: "3%开票金额",
          align: "left",
          needTotal: true,
          width: "100px",
          type: 10,
          dataIndex: "senondInvoiceAmount"
        },
        {
          title: "3%开票税金",
          align: "left",
          width: "100px",
          needTotal: true,
          type: 10,
          dataIndex: "secondTaxAmount"
        },
        {
          title: "发票号",
          align: "left",
          width: "150px",
          dataIndex: "invoiceNo"
        },
        {
          title: "创建日期",
          align: "center",
          width: "100px",
          dataIndex: "createTime"
        },
        {
          title: "申请人",
          align: "center",
          width: "100px",
          dataIndex: "nickName"
        },
        {
          title: "审批状态",
          align: "left",
          fixed: "right",
          dataIndex: "taskName",
          scopedSlots: { customRender: "taskName" }
        },
        {
          title: "操作",
          align: "center",
          dataIndex: "action",
          width: "160px",
          fixed: "right",
          scopedSlots: { customRender: "action" }
        }
      ],
      operator: operator
    }
  },
  methods: {
    setData(data) {
      if (data && data.inoviceId) {
        this.queryParam.invoiceId = data.inoviceId
        this.$refs["table"].refresh(false)
      }
    },
    /**
     * 查询事件
     * @param searchParams
     */
    searchTable(searchParams) {
      this.queryParam = Object.assign(this.queryParam, searchParams)
      this.$refs.table.refresh(true, searchParams)
    },

    /**
     * 刷新列表
     */
    onLoad() {
      this.$refs.table.refresh()
    }
  },
  created() {
  }
}
</script>